Skip to content

test(studio): the edit bench re-reads a waiting box that Studio remounts after a replay - #8807

Merged
miguel-heygen merged 3 commits into
mainfrom
fix/edit-bench-rereads-remounted-waiting-box
Nov 25, 2026
Merged

miguel-heygen merged 3 commits into
mainfrom
fix/edit-bench-rereads-remounted-waiting-box

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

The edit accuracy bench no longer fails a case when Studio remounts the selection box right after a waiting press replays. It reads the box again, as it already does when the replay removes the waiting marker. A waiting box that is still in the page but has no box still fails the case.

Why

seqfastkeys-none-px-r0-root-z100 failed every run with a sealed preview ("element has no rendered box"), and passed unsealed. At step 5 (a drag right after seeking to 2 s, while the preview reloads after the keyframe save) the press waits, so Studio marks the selection box data-dom-edit-press-waiting="save" and draws it at the pointer. The bench takes a handle to that box, reads the element, then reads the box's quad. A MutationObserver trace in Studio's page during the failing runs:

3692 attr data-dom-edit-press-waiting=save on DIV
3908 attr data-dom-edit-press-waiting=null on DIV
3917 removed DIV waiting=null
4006 added DIV waiting=null

The wait ends first (3908 ms), then Studio takes that box out of the page (3917 ms) and mounts a new one 90 ms later. The bench's quad read landed on the removed node, and DOM.getContentQuads on a node that is not in the page returns no quads, so the case threw before its existing "the replay took the marker away" check could run. Studio's edit itself is right: with the bench reading again, every gated check of this case passes sealed.

Related work

Refs #7846 (the sealed preview switch, whose edit accuracy gate reported this case).

How

  • case.mjs: markerQuad reads the waiting box's quad and returns null only when that box is no longer in the page; any other failure still throws. measureShown reads again when the quad is null, as it does when the marker attribute is gone.

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments"

fails without the fix: packages/studio/tests/e2e/edit-accuracy/settle.test.mjs "reads again when Studio took the waiting box out of the page before its box was read" fails on main's case.mjs with Error: element has no rendered box. Making markerQuad always rethrow fails it again; making it never rethrow fails "still fails when a waiting box in the page has no box".

bunx vitest run tests/e2e/edit-accuracy/ in packages/studio: 13 files, 132 of 132, three runs in a row.

The bench on the devbox (built CLI, --filter '^seqfastkeys-none-px-r0-root-z100$'), the preview frame's self.origin logged in every run (null sealed):

Code Preview Run 1 Run 2 Run 3
main 559ad7b sealed element has no rendered box element has no rendered box element has no rendered box
main 559ad7b unsealed pass pass pass
this branch sealed pass pass pass
this branch unsealed pass pass pass

"pass" means every gated check passed. Smoothness, which the gate reports but does not gate, is below its mark in every run of both modes.

Not run: the full grid. The change only alters a run where the waiting box's quad read fails on a box that has left the page, which before ended the case with an error.

No visible change

Changes the edit accuracy bench and its test only.

…nts after a replay

A press that waits on a save is drawn by Studio's selection box. Right after the
replay clears the wait, Studio can remount that box. The bench then read the box
of the detached old node and failed the case with "element has no rendered box".
It now reads again when the marker is gone from the page, and still fails when a
marker in the page has no box.
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 273 (base branch 271), smooth 68 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Newly passing (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Quarantined, measured but not gated (0)

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested at c738e39f.

  • P2 packages/studio/tests/e2e/edit-accuracy/case.mjs:716 — The pre-press waitingQuad read can still throw when Studio remounts the waiting box after Puppeteer captures its handle. The controlled Chromium check confirmed that this aborts pointerGesture before mouse-down. Apply the detached-box handling to this read as well, retaining the error for a connected box with no quad.
  • P2 packages/studio/tests/e2e/edit-accuracy/case.mjs:752 — A box can detach after a successful quad read while its old node still has the waiting attribute. The benchmark then accepts the stale quad. Check connectivity alongside the attribute before accepting the sample, and cover that ordering in the retry test.

All 132 edit-accuracy unit tests and all 15 hosted shards passed. The new detached-before-read regression fails against the parent code. The local fast-keys benchmark completed without a harness exception, but failed its undo-byte check, so it did not independently reproduce the reported end-to-end pass.

— tai (automated review)

… in the page and waiting

The read before the press and the read during the drag now share one reader.
A box that left the page gives no quad instead of throwing, and a box that left
the page right after a good read no longer adds its stale quad. A waiting box
still in the page with no quad still fails the case.
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Both fixed in d5ced7c4 (after a main merge, bc62b7ce).

The read before the press. waitingQuad and measureShown now read the waiting box through one reader, liveMarkerQuad. A box that left the page gives no quad instead of throwing. A waiting box still in the page with no quad still throws. Tests: "before the press, a waiting box that left the page is no waiting box" fails with Error: element has no rendered box when waitingQuad calls the reader directly, as c738e39f did. "before the press, a waiting box in the page gives its quad, or fails when it has none" covers the other side.

A box that detaches right after a good read. The reader now accepts the quad only if the box is still in the page and still waiting, in one check after the read. Test: "does not take the quad of a box that left the page, still marked waiting, after it was read" fails on c738e39f (expected 260 to be +0) and again with isConnected dropped from the check. The stand-in box runs the bench's own check against an element's isConnected and attribute, so the check itself is what is tested.

Undo bytes. I could not reproduce it. On the devbox, the fast-keys case at this head passes undo (bytes and redo bytes equal) in 3 of 3 sealed runs (the frame's self.origin logged as null in each) and 3 of 3 unsealed. Every gated check passes in all six; smoothness is below its mark in all six, as on main. If your undo-byte run kept its results.json, its undo block would show which comparison failed.

bunx vitest run tests/e2e/edit-accuracy/ in packages/studio: 135 of 135, three runs in a row.

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed the edit-accuracy harness at d5ced7c4. The pre-press and drag paths now share the same waiting-box read. A detached box falls back to the current view, and a successful quad is accepted only while its box is connected and still marked waiting. A connected box with no quad still fails the case.

All 135 edit-accuracy unit tests passed locally. The PR body names the regression test that fails without the fix. The hosted grid was still running at review time.

— tai (automated review)

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 25, 2026
@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 47e6307 Nov 25, 2026
141 of 143 checks passed
@miguel-heygen
miguel-heygen deleted the fix/edit-bench-rereads-remounted-waiting-box branch November 25, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants